#include <iostream>
using namespace std;
int main()
{
	int n,k=1;
	int sign=0,x,total=0,sign2=0,sign3=0;
	int m;
	int r1,r2,r3;
	cin>>n;
	if (n>=1456 && n<=145600)
	{
		sign = n / 52;
		for (x=1;x<=100;x++)
		{
			total = 7 * x + 21;
			if (total==sign) {r1=x;sign2=1;break;}
		}
		if (sign2==1) cout<<r1<<'\n'<<k<<endl;
		else
		{
			for (x=100;x>=0;x--)
			{
				total = 7 * x;
				m = sign - total;
				if (m>0 && m%21==0)
				{
					r2 = m / 21;
					r3 = x;
					sign3=1;
					break;
				}
				else continue;
			}
		}
		if (sign3==1) cout<<r3<<'\n'<<r2<<endl;
	}
	else cout<<"Error!"<<endl;
	return 0;
}
